package ru.jexp.mvc;

import java.util.HashMap;
import java.util.Map;

public class HandlerMap {
	private Map<String, IListener> map = new HashMap<String, IListener>();

	public void put(String eventType, IListener listener) {
		map.put(eventType, listener);
	}

	public void handle(Event e) {
		IListener listener = map.get(e.type);
		if (listener != null)
			listener.handle(e);
	}
	
	public void handle(String typeEvent) {
		IListener listener = map.get(typeEvent);
		if (listener != null)
			listener.handle(null);
	}
}
